package com.bwf.bytetochar;

import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/18 9:39
 * @Copyright 博为峰
 */
public class ByteToCharDemo02 {
    public static void main(String[] args) throws IOException {
        /*
           字节流+编码表=字符流
           FileWriter fileWriter = new FileWriter("fo.txt");

           final FileOutputStream fileOutputStream = new FileOutputStream("fo.txt");
           final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "utf-8");
         */
        //字节流
        final FileOutputStream fileOutputStream = new FileOutputStream("fo.txt");
        //桥梁流

        final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "gbk");
        outputStreamWriter.write("你");
        outputStreamWriter.close();

    }
}
